{% extends "eemeter/model_detail.html" %}
{% comment 'header' %}
# This file is part of opentaps Smart Energy Applications Suite (SEAS).

# opentaps Smart Energy Applications Suite (SEAS) is free software:
# you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# opentaps Smart Energy Applications Suite (SEAS) is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public License
# along with opentaps Smart Energy Applications Suite (SEAS).
# If not, see <https://www.gnu.org/licenses/>.
{% endcomment %}

{% load static %}
{% load crispy_forms_tags %}

{% block add_button %}
{% endblock add_button %}

{% block inner_content %}
<div id="model_edit_form">
    <form method="post" @submit="isSaving = true">
      {% csrf_token %}
      {{ form|crispy }}

      <div class="form-group d-flex justify-content-around mt-5">
        <a href="{% if object %}{% url 'core:meter_model_detail' object.id %}{% else %}{% url 'core:meter_detail' meter_id %}{% endif %}" class="btn btn-secondary col-5" role="button"><i class="fa fa-times mr-2"></i> Cancel</a>
        <button class="btn btn-primary col-5" type="submit" :disabled="isSaving"><i class="fa fa-edit mr-2"></i> Save</button>
      </div>
    </form>
</div>

<script>
(function() {
  new Vue({
    delimiters: ['$[', ']'],
    el: '#model_edit_form',
    name: 'model_edit_form',
    data() {
      return {
        isSaving: false
      }
    }
  });
})();
</script>
{% endblock inner_content %}
